package com.shenxuchen.crm.mapper;

import com.shenxuchen.crm.pojo.Value;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface ValueMapper {

    String[] getHasRef(String[] codes);

    @Select("select * from tbl_dictionary_value order by typeCode")
    List<Value> getAll();

    void save(Value value);

    @Select("select * from tbl_dictionary_value where id=#{id}")
    Value getById(String id);

    Value getByIdWithType(String id);

    @Update("update tbl_dictionary_value set value=#{value},text=#{text},orderNo=#{orderNo} where id=#{id}")
    void edit(Value value);

    void delete(String[] ids);

    List<Value> getAllWithType();

    @Update("update tbl_dictionary_value set orderNo=#{orderNo} where id=#{id}")
    void changeOrderNo(@Param("id") String id, @Param("orderNo") int orderNo);

    @Select("select value,text from tbl_dictionary_value where typeCode=#{code}")
    List<Map> loadByCode(String code);
}
